import json
from cn.sys.home.utils.SystemUtils import SystemProperties
import re
     #读取
class Test():

    @staticmethod
    def getdd(json):
        print(json)


    @staticmethod
    def get_url_video_id( content):
        url_pattern = re.compile('"https:(.*)",')
        url_m = re.search(url_pattern, content)
        url = url_m.group()

        id_pattern = re.compile('"videoid": "(\d+)",')
        id_m = re.search(id_pattern, content)
        id = id_m.group()

        filename_pattern = re.compile('"filename": "(.*)",')
        filename_m = re.search(filename_pattern, content)
        filename = filename_m.group()

        print(filename)
        return url,id,filename

    def get_url_video_id_from_str(self, content):
        url_pattern = re.compile('"https:(.*)",')
        url_m = re.search(url_pattern, content)
        url = url_m.group()
        id_pattern = re.compile('"videoid": "(\d+)",')
        id_m = re.search(id_pattern, content)
        id = id_m.group()
        return url, id


if __name__=='__main__':
    _path = SystemProperties.getWebRoot() + "/cn/sys/home/data/cc.json"
    f = open(_path)
    t=f.read()
    print(t)
    Test.get_url_video_id(t)
    # Test.getdd("2312")